package org.hxd.admin.Notices.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.hxd.pojo.Notice;
import org.hxd.utils.PageModel;

import java.util.List;

public interface AdminNoticeDao {
    @Select("select count(*) from notice")
    int findNoticeCount();

    @Select("select * from notice limit #{firstLimitParam},#{pageSize}")
    List<Notice> findNoticeAll(PageModel pageModel);

    @Insert("insert into notice(title,details,n_time) values(#{title},#{details},NOW())")
    int addNoticeForm(Notice notice);

    @Delete("delete from notice where n_id = #{id}")
    int deleteNotice(Integer id);

    @Select("select * from notice where n_id = #{id}")
    Notice findNoticeOne(Integer id);

    @Update("update notice set title=#{title},details=#{details},n_time=NOW() where n_id = #{n_id}")
    int updateNotice(Notice notice);
}
